<div id="tieude_1">
		<p>Cập nhật thông tin trẻ</p>
	</div>
    <div id="noidung_gt">
		<?php
			if (isset($_REQUEST['matre'])) {
				$matre = $_REQUEST['matre'];
				require('connect.php');
				$result = $mysqli->query("select * from tre,hoc,lop,loailop,phuhuynh,dantoc,tongiao where 
								tre.MA_TRE = hoc.MA_TRE and
								hoc.MA_LOP = lop.MA_LOP and
								tre.MA_PH = phuhuynh.MA_PH and
								tre.MA_DT = dantoc.MA_DT and
								tre.MA_TG = tongiao.MA_TG and
								lop.MA_LOAILOP = loailop.MA_LOAILOP and
								tre.MA_TRE = '{$matre}'");
				$row=$result->fetch_array();
			}
		?>
        <form name="formnew" id="formnew" method="post">
    	<table border="0" id="bang">
            <tr>
            	<td width="20%" ><p>Họ tên trẻ <span>(*)</span></p></td>
                <td width="80%">
                    <input type="text" name="hoten" id="hoten" size="50" value="<?php echo $row['HOTEN_TRE']; ?>"/>
                </td>
            </tr>
            <tr>
            	<td ><p>Ngày sinh <span>(*)</span></p></td>
                <td><input type="date" name="ngaysinh" id="ngaysinh" value="<?php echo $row['NGAYSINH_TRE']; ?>" /></td>
            </tr>
            <tr>
            	<td><p>Giới tính  <span>(*)</span></p></td>
                    <td><select name="gioitinh">
                    	<?php 
							if ($row['GIOITINH_TRE'] == "Nam") {
								echo "<option value='Nam' selected>Nam</option>";
								echo "<option value='Nữ'>Nữ</option>";
							} else {
								echo "<option value='Nam'>Nam</option>";
								echo "<option value='Nữ' selected>Nữ</option>";
							}
						?>	 
  						</select>
					</td>
                </tr>
            <tr>
             	<td ><p>Dân tộc <span>(*)</span></p></td>
               	<td><select name="dantoc">
                    	<?php 
							$result1 = $mysqli->query('select * from dantoc');
							while ($row1 = $result1->fetch_array()) {
								if ($row['MA_DT'] == $row1['MA_DT'])
									echo "<option value='{$row1['MA_DT']}' selected>{$row1['TEN_DT']}</option>";
								else echo "<option value='{$row1['MA_DT']}'>{$row1['TEN_DT']}</option>";
							}
						?>	 
  						</select>
				</td>
            </tr>
            <tr>
             	<td ><p>Tôn giáo <span>(*)</span></p></td>
               	<td><select name="tongiao">
                    	<?php 
							$result1 = $mysqli->query('select * from tongiao');
							while ($row1 = $result1->fetch_array()) {
								if ($row['MA_TG'] == $row1['MA_TG'])
									echo "<option value='{$row1['MA_TG']}' selected>{$row1['TEN_TG']}</option>";
								else echo "<option value='{$row1['MA_TG']}'>{$row1['TEN_TG']}</option>";
							}
						?>	 
  						</select>
				</td>
            </tr>
            <tr>
             	<td ><p>Phụ huynh <span>(*)</span></p></td>
               	<td><select name="phuhuynh">
                    	<?php 
							$result1 = $mysqli->query('select * from phuhuynh');
							while ($row1 = $result1->fetch_array()) {
								if ($row['MA_PH'] == $row1['MA_PH'])
									echo "<option value='{$row1['MA_PH']}' selected>{$row1['HOTEN_PH']}</option>";
								else echo "<option value='{$row1['MA_PH']}'>{$row1['HOTEN_PH']}</option>";
							}
						?>	 
  						</select>
				</td>
            </tr>
            <tr>
             	<td ><p>Lớp học <span>(*)</span></p></td>
               	<td><select name="loailop">
                    	<?php 
							$result1 = $mysqli->query('select * from loailop');
							while ($row1 = $result1->fetch_array()) {
								if ($row['MA_LOAILOP'] == $row1['MA_LOAILOP'])
									echo "<option value='{$row1['MA_LOAILOP']}' selected>{$row1['TEN_LOAILOP']}</option>";
								else echo "<option value='{$row1['MA_LOAILOP']}'>{$row1['TEN_LOAILOP']}</option>";
							}
						?>	 
  						</select> - 
                     <select name="lophoc">
                    	<?php 
							$result1 = $mysqli->query('select * from lop');
							while ($row1 = $result1->fetch_array()) {
								if ($row['MA_LOP'] == $row1['MA_LOP'])
									echo "<option value='{$row1['MA_LOP']}' selected>{$row1['TEN_LOP']}</option>";
								else echo "<option value='{$row1['MA_LOP']}'>{$row1['TEN_LOP']}</option>";
							}
						?>	 
  						</select>
				</td>
            </tr>
            <tr><td colspan="2"><p><b>Cập nhật tình hình phát triển tháng hiện tại của trẻ</b></p></td></tr>
            <tr>
            	<td><p>Chiều cao (cm)</span></p></td>
                <td>
                    <input type="text" name="hoten" id="hoten" size="20" value="100"/>
                </td>
            </tr>
            <tr>
            	<td><p>Cân nặng (kg)</span></p></td>
                <td>
                    <input type="text" name="hoten" id="hoten" size="20" value="100"/>
                </td>
            </tr>
            <tr>
             	<td ><p>Tiêm ngừa</p></td>
               	<td><select name="phuhuynh">
                		<option value=''>Không có tiêm ngừa</option>
                    	<?php 
							$result1 = $mysqli->query('select * from tiemngua');
							while ($row1 = $result1->fetch_array()) {
								echo "<option value='{$row1['MA_TN']}'>{$row1['HOTEN_PH']}</option>";
							}
						?>	 
  						</select>
				</td>
            </tr>
            <tr>
            	<td>&nbsp;</td>
                <td id="nut"><input type="submit" value="Lưu lại" />
                			<input type="reset" value="Hủy" /></td>
            </tr>
            <tr>
            	<td id="tt" colspan="2"><span>(*)</span> Thông tin bắt buộc nhập</td>
            </tr>
    	</table>
	</form>
